package com.master.controller;

import com.master.rabbitmq.MQSender;
import com.master.util.CodeMsg;
import com.master.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class DemoController {

    @Autowired
    MQSender sender;

    @RequestMapping("/hello")
    @ResponseBody
    public Result<String> hello(){
        return Result.success("Spring Boot");
    }

    @RequestMapping("/thymeleaf")
    public String thymeleaf(Model model){
        model.addAttribute("name","abc");
        return "hhh";
    }

//    @RequestMapping("/mq")
//    @ResponseBody
//    public Result<String> rabbitDemo(){
//        sender.send("helloworld");
//        return Result.success(CodeMsg.SUCCESS.getMsg());
//    }
}
